<?php

namespace App\Api\Logic;

use App\Api\Logic\Validate\UserRechargeValidate;
use App\Exceptions\ValidationException;
use App\Helpers\ResponseEnum;

class UserRechargeLogic extends BaseLogic
{

    /**
     * 获取请求对象的实力
     * @return UserRechargeValidate
     */
    private function getValidate():UserRechargeValidate{
        return  new UserRechargeValidate();
    }

    /**
     * 创建充值的订单
     * @return void
     */
    public function createUserRecharge($params){
        $validate = $this->getValidate();
        if(!$validate->scene('createUserRecharge')->check($params)){
            throw new ValidationException(ResponseEnum::HTTP_ERROR,$validate->getError());
        }
    }

    /**
     * @param array $data
     * @return void
     */
    public function getUserRechargeInfo(array $data)
    {
        $validate = $this->getValidate();
        if(!$validate->scene('getUserRechargeInfo')->check($data)){
            throw new ValidationException(ResponseEnum::HTTP_ERROR,$validate->getError());
        }
    }
}
